#ifndef JLIB_GRAPHICS_MANAGERS_ACTIONMANAGER_H
#define JLIB_GRAPHICS_MANAGERS_ACTIONMANAGER_H

#include "../actions/action.h"
#include <unordered_map>
#include <vector>

namespace jlib {


struct ActionManager : public Object {

  void start (Action *action);

  void stop (Action *action);

  void stop (Object *target);

  void stopAll ();

  void update (float dt);

  void clear ();

  inline bool init () noexcept { return true; }

protected:

  std::unordered_map<Object*, std::vector<Objptr<Action> > > _buckets;
  std::vector<Objptr<Action> > _startCache;
  bool _updating {false};

}; // struct ActionManager


} // namespace jlib

#endif // JLIB_GRAPHICS_MANAGERS_ACTIONMANAGER_H
